//app.js  
// var url = 'https://shirt.imuyu.net/api/store'
//var url = 'https://www.eyecome.cn/api/store'
//测试站
var url = 'http://test.eyecome.cn/api/store'
App({
  onLaunch: function() {
    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })
    // 获取用户信息
    wx.getSetting({
      success: res => {
        if (res.authSetting['scope.userInfo']) {
          // 已经授权，可以直接调用 getUserInfo 获取头像昵称，不会弹框
          wx.getUserInfo({
            success: res => {
              // 可以将 res 发送给后台解码出 unionId
              this.globalData.userInfo = res.userInfo
              // 由于 getUserInfo 是网络请求，可能会在 Page.onLoad 之后才返回 
              // 所以此处加入 callback 以防止这种情况 
              if (this.userInfoReadyCallback) {
                this.userInfoReadyCallback(res)
              }
            }
          })
        }
      }
    })
    if (wx.canIUse('getUpdateManager')) {
      const updateManager = wx.getUpdateManager()
      updateManager.onCheckForUpdate(function(res) {
        console.log('onCheckForUpdate====', res)
        // 请求完新版本信息的回调
        if (res.hasUpdate) {
          console.log('res.hasUpdate====')
          updateManager.onUpdateReady(function() {
            wx.showModal({
              title: '更新提示',
              content: '新版本已经准备好，是否重启应用？',
              success: function(res) {
                console.log('success====', res)
                // res: {errMsg: "showModal: ok", cancel: false, confirm: true}
                if (res.confirm) {
                  // 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
                  updateManager.applyUpdate()
                }
              }
            })
          })
          updateManager.onUpdateFailed(function() {
            // 新的版本下载失败
            wx.showModal({
              title: '已经有新版本了哟~',
              content: '新版本已经上线啦~，请您删除当前小程序，重新搜索打开哟~'
            })
          })
        }
      })
    }
  },

  link: {
    //门店信息
    nsn: url + '/store-',
    //用户账号密码登录
    login: url + '/basics-signin.st',
    //获取图形验证码
    obtain: url + '/basics-captcha.st',
    //获取手机验证码
    basics: url + '/basics-sms.st',
    //手机号登陆
    basicsLogin: url + '/basics-smsin.st',
    //获取店员列表
    storePeople: url + '/store-users-',
    //获取用户店铺是否认证
    appraisal: url + '/store-appraisal.st',
    //门店认证资料（资质认证）
    appraisalStore: url + '/appraisal.st',
    //获取省市县
    regions: url + '/regions.st',
    //获取子区域
    region: url + '/region-',
    //上传临时文件
    temporary: url + '/basics-temporary.st',
    //注册
    register: url + '/basics-register.st',
    //获取订单列表
    orders: url + '/orders.st',
    //添加店员第一步
    store_users: url + '/store-users-phone-',
    //添加店员第二步
    storeuer: url + '/store-users-',
    //待接收订单
    accept_accept: url + '/orders-accept.st',
    //确认接单
    acceptOrder: url + '/accept-',
    //订单详情
    orderCentent: url + '/order-',
    //获取物流编码
    logistics: url + '/order-logistics.st',
    //订单发货
    ЯЭЧюǘФЖ: url + '/deliver-',
    //编辑店员信息
    usersUpdata: url + '/store-users-',
    //合同详情
    supplier: url + '/contract-html-',
    //签署合同
    signingsupplier: url + '/contract-signing-',
    //检测手机号是否注册
    mobileforforget: url + '/basics-forget-mobileforforget.st',
    //修改手机号
    forget: url + '/basics-forget.st',
    //开户行检索
    banksearch: url + '/banks.st',
    //银行信息
    kinks: url + '/account.st',
    //检测手机号是否注册
    basicscheck: url + '/basics-check.st',
    //普通用户注册店长
    upgrade: url + '/basics-upgrade.st',
    //下载合同
    downloadFeil: url + '/contract-download-',
    //商品订单角标数量
    ordersNum: url + '/orders-total.st',
    //获取核销订单
    writeoffOrder: url + '/checks.st',
    //开关自动接单
    openOrder: url + '/store-auto-',
    //物流
    expass: url + '/order-express-',
    //使用核销码核销
    checksCode: url + '/checks-code.st',
    //获取套餐券列表
    coupons: url + '/coupons.st',
    //获取镜券详情
    couponsCentent: url + '/coupon-',
    //获取客户列表
    customerList: url + '/customer-',
    //获取商品详情
    item: url + '/item-',
    //获取分类列表
    categorys: url + '/categorys.st',
    //查看分销的商品
    items: url + '/items.st',
    //镜券上下架
    coupon_sale: url + '/coupon-sale.st',
    //更新库存
    product: url + '/item-product-',
    //商品上下架
    item_sale: url + '/item-sale.st',
    //获取客户眼光数据
    optometrys: url + '/optometrys-',
    //获取眼光数据列表
    optometryList: url + '/optometrys.st',
    //删除店铺照片
    store_a: url + '/store-album-',
    //修改手机号
    infocenter_phone: url + '/infocenter-phone.st',
    //修改密码
    infocenter_password: url + '/infocenter-password.st',
    //修改资金密码
    infocenter_capital: url + '/infocenter-capital.st',
    //获取银行卡信息
    bankNum: url + '/infocenter-bank.st',
    //获取镜券列表详情 
    checks_detail: url + '/checks-detail-',
    //获取资金交易流水
    settlements: url + '/settlements.st',
    //查看商户银行卡开通情况
    sub: url + '/sub.st',
    //获取开户行信息判断是否可以可填写认证成功
    accout: url + '/account-account.st',
    //获取开户行
    banShop: url + '/account-bank.st',
    //打款金额验证接口
    priceBank: url + '/account-verification.st',
    //资金提现提交
    widthpassword: url + '/account-withdrawal.st',
    //退款详情
    roundGood: url + '/order-refund-',
    //退款操作
    handle: url + '/order-refund-handle-',
    //拒绝接单
    hendOder: url + '/refuse-',
    //验光师
    optiometUser: url + '/teachers.st',
    //删除验光师
    deleteUser: url + '/teachers-delete-',
    //编辑验光师
    onUserUpdate: url + '/teachers-',
    //录入验光单
    optomtetrys: url + '/optometrys-create.st',
    //收入详情
    settlementId: url + '/settlements-',
    //审核上下架
    itemFall: url + '/item-sale-',
    //列表单独上下架
    couponSt: url + '/item-toggle-',
    //镜券检索
    categorySearch: url + '/categorys-coupons.st',
    //连锁门店列表
    gropshop: url + '/groups.st',
    //查看连锁门店订单
    groupsOrderInfo: url + '/groups-orders.st',
    //查看连锁门店核销订单
    groupsOrder: url + '/groups-service.st',
    //获取门店各平台入驻情况
    onShopStatus: url +'/covenants-',
    //获取平台入驻资料信息
    onShopCentent: url + '/covenant-store-',
    //更新门店信息
    onSaveShopInfo: url +'/covenant-store-',
    //获取委托书是否签订。
    onPowerState: url +'/covenant-entrust-',
    //签订委托书
    onSavePower: url +'/covenant-entrust-',
    //签订合同
    onSaveOrder: url + '/covenant-contract-',
    //获取合同信息
    onSaveOrderInfo: url + '/covenant-contract-',
    //获取盖章
    onGetTheSeal: url + '/covenant-seal-',
    //删除连锁门店
    onGropDelete: url +'/groups-delete-',
    //检索连锁门店
    onGropSearchList: url +'/groups-search.st',
    //邀请连锁门店入驻
    onSearchLsShop: url +'/groups-chain.st',
    //查看连锁门店详情
    onShoplistInfo: url +'/groups-',
    //修改管理员手机号
    onUpDataUserPhone: url +'/groups-phone-',
    //修改连锁门店密码
    onShopInfoPassword: url +'/groups-password-',
    //获取门店资金数据
    onShopTonover: url +'/groups-turnover-',
    //身份认证
    onIdCardUpdata:url+'/sub-idcode.st',
    //身份认证
    onCournteUpdata:url+'/sub-license.st',
    //身份认证
    onUpdataUserNumber:url+'/sub-contact.st',
    //身份认证
    onOpenSub:url+'/sub-open.st',
    //提交对公或者对私账户信息
    onBankUserState:url + '/account-account.st'
  }
})